//
//  WJTutorialPageViewController.swift
//  PDFSign
//
//  Created by 李永彬 on 2025/10/21.
//

import UIKit

class WJTutorialPageViewController: UIViewController {
    
    // MARK: - Lazy UI Components
    private lazy var imageView: UIImageView = {
        let imageView = UIImageView()
        imageView.contentMode = .scaleAspectFit
        imageView.clipsToBounds = true
        imageView.backgroundColor = .clear
        return imageView
    }()
    
    private lazy var descriptionLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.montserratBold(24)
        label.textColor = .darkGray
        label.textAlignment = .center
        label.numberOfLines = 0
        return label
    }()
    
    private lazy var contentView: UIView = {
        let view = UIView()
        view.backgroundColor = .clear
        return view
    }()
    
    // MARK: - Lifecycle
    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
    }
    
    // MARK: - Setup Methods
    private func setupUI() {
        view.backgroundColor = UIColor(hex: "#E7F2FE")
        
        // 添加内容容器
        view.addSubview(contentView)
        contentView.addSubview(imageView)
        contentView.addSubview(descriptionLabel)
        
        // 内容容器约束
        contentView.snp.makeConstraints { make in
            make.edges.equalTo(view.safeAreaLayoutGuide)
        }
        
        // 图片约束
        imageView.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(55)
            make.leading.trailing.equalToSuperview()
        }
        
        // 描述约束
        descriptionLabel.snp.makeConstraints { make in
            make.top.equalTo(imageView.snp.bottom).offset(20)
            make.leading.equalToSuperview().offset(40)
            make.trailing.equalToSuperview().offset(-40)
        }
    }
    
    // MARK: - Configuration
    func configureWith(description: String, imageName: String) {
        descriptionLabel.text = description
        imageView.image = UIImage(named: imageName)
    }
}
